<%@ page pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>


<%@ page import="org.jawa.core.util.JawaGlobals,org.jawa.admin.util.ParamUtils"%>
<%@ page import="java.util.HashMap"%>
<%@ page import="java.util.Locale"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.StringTokenizer"%>

<jsp:useBean id="webManager" class="org.jawa.admin.util.WebManager"  />
<% webManager.init(request, response, session, application, out); %>
<%
	String path = request.getContextPath();
%>
<%  // Get parameters
	String localeCode = ParamUtils.getParameter(request,"localeCode");
	boolean save = request.getParameter("save") != null;
	
	Map<String,String> errors = new HashMap<String,String>();
	
	if (save) {
	    Locale newLocale = null;
	    if (localeCode != null) {
	        newLocale = JawaGlobals.localeCodeToLocale(localeCode.trim());
	        if (newLocale == null) {
	            errors.put("localeCode","");
	        }
	        else {
	        	JawaGlobals.setXMLProperty("locale",newLocale.toString());
	        	JawaGlobals.setLocale(newLocale);
	            // redirect
	            response.sendRedirect("setup-datasource-settings.jsp");
	            return;
	        }
	    }
	}
	Locale locale = JawaGlobals.getLocale();
%>

<html>
<head>
<title>语言设置</title>
<meta name="currentStep" content="2" />
</head>
<body>
<div class="row-fluid">
			<div class="page-header">
				<h3>
					语言设置
				</h3>
				<p>欢迎eLearning设置。本工具将引导您进行服务器的初使化设置。在开始这前，请选择你喜爱的语言。</p>
			</div>

<!-- BEGIN jawa-contentBox -->
<div class="well">
	<h2>选择语言</h2>
	<form action="setup-language-settings.jsp" name="sform">
		<%
			boolean usingPreset = false;
		%>
		<div id="jawa-setup-language">
			<table class="table table-striped " >
				<tr>
					<td>
						<input type="radio" name="localeCode" value="en" <%=("en".equals(locale.toString().trim()) ? "checked" : "")%> id="loc03" /> 
						<strong>English</strong> (en)
						<br>
						<input type="radio" name="localeCode" value="zh_CN" <%=("zh_CN".equals(locale.toString()) ? "checked": "")%> id="loc10" />
						<strong>
							<img src="<%=path %>/images/jawa-setup-language-zh_CN.gif" border="0" align="top" />
							Simplified Chinese
						</strong>(zh_CN)
					</td>
				</tr>
			</table>

			<div class="form-actions">
				<input type="submit" name="save" value="继续" id="jawa-setup-save" class="btn btn-primary">
			</div>
		</div>
	</form>
</div>
</div>
<!-- END jawa-contentBox -->
</body>
</html>
